from __future__ import annotations

from dataclasses import dataclass
from typing import List, Dict, Callable
from datetime import date


@dataclass
class BacktestEngine:
    pick_fn: Callable[[date], List[Dict]]

    def run(self, dates: List[date]) -> List[Dict]:
        """按给定交易日序列运行回测，调用选股函数并汇总结果。"""
        results: List[Dict] = []
        for d in dates:
            picks = self.pick_fn(d)
            results.append({"date": d, "num_picks": len(picks)})
        return results




